package mashupapirecommendation;

import org.eclipse.jface.action.ICoolBarManager;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.ToolBarContributionItem;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

import cn.edu.zju.ccnt.mashup.ui.actions.ExecuteSparqlAction;
import cn.edu.zju.ccnt.mashup.ui.actions.SelectRDFSAction;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	private SelectRDFSAction selectRDFSAction; 
	private ExecuteSparqlAction executeSparqlAction;
	
    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(IWorkbenchWindow window) {
    	super.makeActions(window); 
    	selectRDFSAction = new SelectRDFSAction(window); 
    	executeSparqlAction = new ExecuteSparqlAction(window);
    }

    protected void fillMenuBar(IMenuManager menuBar) {
    	super.fillMenuBar(menuBar); 
    	MenuManager demoMenu = new MenuManager("&File", ""); 
    	demoMenu.add(selectRDFSAction); 
    	menuBar.add(demoMenu); 
    	
    	//add run
    	MenuManager demoMenu2 = new MenuManager("&Run", ""); 
    	demoMenu2.add(executeSparqlAction); 
    	menuBar.add(demoMenu2); 
    }
    
    protected void fillCoolBar(ICoolBarManager coolBar) { 
    	IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
    	coolBar.add(new ToolBarContributionItem(toolbar, "main")); 
    	toolbar.add(selectRDFSAction); 
    	toolbar.add(executeSparqlAction); 
    }
    
}
